from sqlalchemy import TEXT, String
from sqlalchemy.orm import Mapped, mapped_column

from .base import TimedBaseModel


class Discount(TimedBaseModel):
    __tablename__ = "discount"
    __mapper_args__ = {"eager_defaults": True}

    id: Mapped[int] = mapped_column(primary_key=True)
    title: Mapped[str] = mapped_column(String(255))
    text: Mapped[str] = mapped_column(TEXT)

    def __repr__(self):
        return f"<Акция №{self.id} {self.title}>"

    def __str__(self):
        return self.__repr__()
